const dbMod = require('../db/dbMod')

function getinfo (userID, callback) {
  let sql = 'SELECT * FROM user where userID = ?';
  dbMod.query(sql, [userID], (result) => {
    var result = eval(result)
    callback(result)
  })
}

function setinfo (userID, userName, userGender, userAge, userProfile, callback) {
  let sql = 'UPDATE user SET userName=?, userGender=?, userAge=?, userProfile=? WHERE userID=?';
  dbMod.query(sql, [userName, userGender, userAge, userProfile, userID], (result) => {
    var result = eval(result);
    callback(result);
  })
}

exports.getinfo = getinfo
exports.setinfo = setinfo